home *** CD-ROM | disk | FTP | other *** search
-
- DOCUMENTSATION TO Za SHELL
-
- written by Matt Dillon, Public Domain
-
- dillon@berkeley.edu, ...!ucb-vax!dillon or ...!ucbvax!dillon
-
- SECTION TITLE
-
- 0 compiling
- I startup, auto sourcing your .login on startup
- II simple commands
- III Substitution/history Command line features
- IV The alias command
- V The set command
- VI special set variables
- VII labels and loops
-
- Appendix I Complete Command list
-
- 0. compiling ------------------------------------------
-
- Compile each module as follows: (specifying wherever your include
- directory is with the -i on lc1)
-
- lc1 -idf0:include/ xxx
- lc2 -s -v xxx
-
- Then link with: (change libs to wherever yours are)
-
- alink df0:clib/lstartup.obj+main.o+globals.o+execom.o+comm1.o+comm2.o+set.o+sub.o library df0:clib/lc.lib+df0:clib/amiga.lib to shell
-
-
-
-
- I. Startup ------------------------------------------
-
- Assuming you've named your executable 'shell', you may execute the
- shell FROM A CLI by typeing:
-
- shell
-
- To have the shell automagically source an initialization file,
- specify the file as an argument:
-
- shell .login
-
- You can place this line in your startup-sequence file to have
- the workbench diskette go into a shell rather than the workbench.
- It is suggested that you have a stack of 8192 (or more). Thus, the
- entire boot from a startup-sequence file would look like:
-
- stack 8192
- shell .login
-
- Your initialization file is simply a sequence of shell commands. I
- have included my .login file as an example (see LOGIN). The file
- usually consists of aliases.
-
-
-
- I. Simple Commands ------------------------------------------
-
- quit -quit out of shell
- set varname string -set variable to string
- unset varname -unset a variable
- alias name string -alias something to a sequence of commands
- unalias name -unalias that something
- echo string -echo a string
- source file -source a file (execute shell coms)
- mv from to -exactly RENAME
- cd dir -change dir (you can use .. to go back one)
- rm file file.. -remove files
- mkdir dir dir.. -create directories
- history -display history
- mem -display free memory
- cat file -'type' a file
- dir [file] -directory of current dir or specified file/dir
- devinfo [dev:] -device information current/specified
- foreach var ( arglist) command
- -see description below
- return -abort a source file from the source file
- if arg <=> arg -conditional
- else -if-else
- endif -end of if or if-else
- label name -create a label (only within source files)
- goto name -goto a label (only within source files)
- inc var [count] -increment an numeric-ascii variable
- dec var [count] -decrement
- input var -input a line to the variable
- version -print shell version #
-
- Any other string is taken to be a disk command an Execute() 'd. Note
- that the above commands can be abbreviated by any number of characters, so
- for instance you cannot have 'a' execute 'a'.. it will execute 'alias'. You
- would have to 'ram:a' (or whatever) to execute it.
-
-
-
- III. Substitution/history Command line features -----------------------
-
- * Standard commands may be abbreviated to any number of characters.
- It is suggested that you do NOT abbreviate commands in source files
- to keep those files compatible with future versions of my shell
-
- * Standard I/O redirection is to the current window. You may specify
- redirection (<file >file) at any place on the command line. I/O
- redirection ONLY WORKS FOR DISK COMMANDS! You cannot redirect
- internal commands.
-
- A command line looks like:
-
- COMMAND arg arg .... ; COMMAND arg arg ... .....
-
- Multiple commands are separated by a semicolon. Alias substitution
- is checked only on the COMAND (the name of the command) argument.
- You may substitute set variables with:
-
- $variable_name
-
- You may do file expansion by specifying an argument which contains
- '?' or '*' in it. For instance:
-
- echo *.c *.h
-
- You may do history substitution with '!': (you can get your history
- with the HISTORY command)
-
- !! -re-execute last command
- !partial -re-execute last command beginning
- with 'partial'.
- !123 -re-execute command # 123
-
- For example:
-
- % echo charlie
- charlie
- % set a xxx
- % !e
- charlie
-
- You may overide any special character with the '\' character, So
- if you do not want '*' to attempt a file-name expansion, use \*.
-
-
- IV. The alias command ------------------------------------------
-
- alias -show current aliases
- alias name -show one alias
- alias name comands -create an alias
-
- % alias logout quit
- % alias hello "echo hello; echo hello"
-
- The quotes are required or the semi-colon might be construed as a
- command delimeter rather than part of the alias. There is one other
- feature of the alias. You can collect argument given after an
- alias with:
-
- alias name "%var commands. .. $var ... ."
-
- E.g. place a '%var' as the first argument in the substitution string,
- and the remaining argument will be placed in that variable for the
- duration of the alias. For example:
-
- % alias xxx "%i echo $i $i $i $i"
- % xxx hello
-
- hello hello hello hello
-
-
-
- V. The set command ------------------------------------------
-
- set -show set variables
- set var -show a single set variable or
- set to "" if it doesn't existd
- set var name -set a variable to a string
-
- .. $var.. -use a set variable
-
-
-
- VI. Special set variables ------------------------------------------
-
- Additionaly, the following set variables are special:
-
- _prompt command
- _history value
-
-
- The _prompt variable contains the command to execute to display your
- prompt. Usually, this is
-
- echo -n "%"
-
- The _history variable sets the number of previous commands which
- you want the shell to remember.... usually around 20
-
-
- VII. Labels and loops ------------------------------------------
-
- label name
- goto label
- if arg <=> arg
- else
- endif
-
- label and goto can only be executed from a shell script. These
- allow you to randomly go anywhere within a shell script. Coupled
- with the conditionals, you can create loops if you wish. As far
- as the conditionals go, if the left argument is numeric, both
- arguments are treated as numeric rather than string for the
- comparision.
-
- if 1 < 5 smaller
- if 1 > 4 larger
- if a <= back smaller or equal
- >= larger or equal
- = equal
- != not equal
-
- IF's, ELSEs, and ENDIF's may be executed at any time. Additionaly,
- a GOTO or RETURN from within a source file 'does the right thing'
- in terms of restoring the correct conditional state.
-
-
- AP I Complete Command list ------------------------------------------
-
- QUIT
- Quit out of the shell...
-
- SET
- SET name
- SET name string
- Display set variables, display a single variable or set to "" if
- it doesn't exist, and set a variable to a string.
-
- UNSET name name...
- unset one or more variables
-
- ALIAS
- ALIAS name
- ALIAS name command
- ALIAS name "command;command..."
- same as set (but in a different name space) in terms of operation.
- alias a name to a command (sequence). When using the alias, you cannot
- abbreviate the name.
-
- UNALIAS name name name...
- unalias one or more variables
-
- ECHO [-n] string
- echo a string (-n means without newline at end)
-
- SOURCE file
- execute shell commands from a file.
-
- RETURN
- return from within a source file
-
- MV from to
- RENAME, exactly
-
- CD [dir]
- cd to a directory, cd to your current device base if you do not
- specify any arguments. You may specify '..' in your path to go
- back a directory.
-
- RM file file file...
- remove file(s)
-
- MKDIR name name name
- create directory(s)
-
- HISTORY
- Display history of commands that have been executed
-
- MEM
- Display memory free
-
- CAT file file ..
- TYPE files out
-
- DIR [file file..]
- Directory (use current dir if no args given)
-
- DEVINFO [dev: dev: ...]
- Device information (use current device if no args given)
-
- FOREACH var ( arglist ) command
- FOREACH var ( arglist ) "command;command..."
- Foreach space delimited item in arglist, place that item in the
- specified set variable, and execute the specified command. This allows you
- to do a given operation on several 'arguments' automatically. you MUST BE
- SURE to delimit the parenthesis by a space on either side!!!
-
- % foreach i ( *.c ) echo $i
- comm1.c
- comm2.c
- execom.c
- globals.c
- main.c
- set.c
- sub.c
-
- IF arg <=> arg
- ELSE
- ENDIF
- Conditional. (<,>,<=,>=,=,!=) If the left argument is a number,
- both arguments are taken to be numbers and compared as numbers instead of
- strings. ALWAYS REMEMBER to put an 'endif' to end the conditional.
-
- LABEL name
- GOTO name
- Labels and goto's. These only work inside source files, since I
- use fseek() and you can't fseek() your tty.
-
- INC var [count]
- DEC var [count]
- Increment and decrement a variable numerically by one (or count if
- specified)
-
-
- INPUT var
- This is a cluge. You can input a string into a variable. E.G.
-
- echo -n Input a filename:
- input charlie
- source $charlie
-
- VERSION
- print the current version
-
-
-
-
-